﻿@model IndoReputation.Models.BusinessObject.Collections.RegionList

@{
    ViewBag.Title = "List Region";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>List Region</h2>     

 <div class="grid-main">
@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .ToolBar(toolbar => toolbar.Template(@<text>@item.CustomCommandToolBarButton("add","Add new Region","Add","Region",null)</text>))   
        .Columns(columns =>
		{
			columns.Bound(o => o.No).Width(50);
            //columns.Bound(o => o.ID).Width(200);
            columns.Bound(o => o.Name).Width(200);
            columns.Bound(o => o.CreateAt).Format("{0:dd/MM/yyyy}").Width(80);
            columns.Command(command => command
                .Custom("viewDetail")
                .Text("Edit")
                .DataRouteValues(route => route.Add(o=>o.ID).RouteKey("regionID"))
                .Ajax(false)
                .Action("Edit","Region"))
                .HtmlAttributes(new { style = "text-align: center" })
                .Width(80);
        })
        .DataBinding(dataBinding => 
        {
            dataBinding.Server().Select("List", "Region", new { ajax = ViewData["ajax"] });
            dataBinding.Ajax().Select("_List", "Region").Enabled((bool)ViewData["ajax"]);
        })
        .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
        .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
        .Pageable(paging => paging.PageSize(20).Enabled((bool)ViewData["paging"]))
        .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
        .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
        .Footer((bool)ViewData["showFooter"])        
)
</div>